#define DEBUG
#include <cstdio>
#define MAXX 41

using namespace std;

long long lcm(long long a, long long b) {
  long long n=a, m=b, r=n%m;
  for (; r; n=m, m=r, r=n%m);
  return a/m*b;
}

int main() {
#ifdef DEBUG
  freopen("0.in", "r", stdin);
  freopen("0.out", "w", stdout);
#endif

  long long a, b;
  scanf("%lld %lld", &a, &b);

  long long temp=1, ans=0;
  static int text[MAXX+1];
  for (int i=2; i<=MAXX; i++) {
    text[i]=1;
    for (int j=1, temp=i; temp>2; j++) {
      if (temp%j) {
	text[i]++;
	temp=j;
	j=1;
      }
    }
    ans += (text[i]+1)*(b/temp+(a-1)/lcm(temp, i)-(a-1)/temp-b/lcm(temp, i));
    temp = lcm(temp, i);
  }

  printf("%lld", ans);

  fcloseall();
  return 0;
}
